<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../js/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />
		<script src="../js/jquery.min.js"></script>
		<script src="../js/layui/layui.js"></script>
		<script src="../js/common.js"></script>
	</head>

	<body>
		<style type="text/css">
			.box {
				width: 200px;
				height: 100px;
				line-height: 100px;
				border: 1px solid #CCCCCC;
				text-align: center;
			}
			
			.box-1 {
				height: 200px;
			}
			
			.box[attr-1="x1"] {
				background: #fed8d8;
			}
		</style>
		<div id="d1" class="box" attr-1=""></div>
		<button type="button" onclick="$('.box').addClass('box-1')">改变1</button>
		<button type="button" onclick="document.getElementById('d1').setAttribute('attr-1','x1')">改变2</button>
		<button type="button" onclick="document.getElementById('d1').innerHTML='HTML'">改变3</button>
		<script type="text/javascript">
			$.watchDom(document.getElementById('d1'), function() {
				layer.alert('box改变');
			});
		</script>
	</body>

</html>